package com.song.user.stream.consumer;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import java.util.function.Consumer;

@Component
public class StreamConsumer {

    /**
     * rabbit消费者函数，bean的名称对应bing的配置
     * @return
     */
    @Bean
    public Consumer<String> log(){
        return m -> {
            System.out.println("日志：" + m);
        };
    }

    /**
     * kafka消费者函数，bean的名称对应bing的配置
     * @return
     */
    @Bean
    public Consumer<String> message(){
        return m -> {
            System.out.println("消息：" + m);
        };
    }
}
